import request from '@/utils/request'
import apis from './'

export function getCity (pid) {
  return request({
    url: `${apis.GetCity}?parent_id=${pid}`,
    method: 'get'
  })
}

export function getPassword () {
  return request({
    url: apis.ChangePassword,
    method: 'get'
  })
}

export function changePassword (data) {
  return request({
    url: apis.ChangePassword,
    method: 'post',
    data: data
  })
}

export function getBusiness (id) {
  return request({
    url: `${apis.Business}?category=${id}`,
    method: 'get'
  })
}

export function getAllBusiness (parameter) {
  return request({
    url: apis.Business,
    method: 'get',
    params: parameter
  })
}

export function takeCall () {
  return request({
    url: apis.Call,
    method: 'get'
  })
}

export function doCall (data) {
  return request({
    url: apis.Call,
    method: 'post',
    data: data
  })
}

export function getCallNum () {
  return request({
    url: apis.GetCall,
    method: 'get'
  })
}

export function onReload () {
  return request({
    url: apis.Refresh,
    method: 'get'
  })
}

export function donwloadFile (value, filename) {
  return request({
    url: `${apis.Download}?value=${value}&filename=${filename}`,
    method: 'get'
  })
}

export function baseUpload (file) {
  return request({
    url: apis.Upload,
    method: 'post',
    data: file
  })
}

export function onSearch (parameter) {
  return request({
    url: apis.Search,
    method: 'get',
    params: parameter
  })
}

export function globalSearch (parameter) {
  return request({
    url: apis.GlobalSearch,
    method: 'get',
    params: parameter
  })
}

export function lockCustomer (company, id) {
  return request({
    url: `${apis.LockCustomer}?company=${company}&customer_id=${id}`,
    method: 'get'
  })
}

export function ocrIdcard (url, side) {
  return request({
    url: `${apis.GetId}?img_url=${url}&side=${side}`,
    method: 'get'
  })
}

export function ocrLicense (url) {
  return request({
    url: `${apis.GetLicense}?img_url=${url}`,
    method: 'get'
  })
}

export function ocrPdf (url) {
  return request({
    url: `${apis.GetPdf}?file_url=${url}`,
    method: 'get'
  })
}

export function ocrImage (url) {
  return request({
    url: `${apis.GetImg}?img_url=${url}`,
    method: 'get'
  })
}

export function autoSubject (subject) {
  return request({
    url: `${apis.AutoSubject}?subject=${subject}`,
    method: 'get'
  })
}
